<template>
  <v-card>
      <v-flex xs12 sm10>
        <v-tree url="/item/category/list"
                :isEdit="isEdit"
                @handleAdd="handleAdd"
                @handleEdit="handleEdit"
                @handleDelete="handleDelete"
                @handleClick="handleClick"
        />
      </v-flex>
  </v-card>
</template>

<script>

  export default {
    name: "category",
    data() {
      return {
        isEdit:true,
        treeDataL:[]
      }
    },
    methods: {
      handleAdd(node) {
        // 发起请求
        this.$http.post("/item/category/node",
          node).then(({data}) => { // 这里使用箭头函数
            //需要重新请求数据
          console.log(data);
        })
      },
      handleEdit(id, name) {
        //点修改没反应
        console.log("edit... id: " + id + ", name: " + name)
      },
      handleDelete(id) {
        this.$http.delete("/item/category/"+id)
          .then(resp => { // 这里使用箭头函数
          console.log(resp);
        })
      },
      handleClick(node) {
        console.log(node)
      }
    }
  };
</script>

<style scoped>

</style>
